<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="UsuarioEditDlg" widgetVar="UsuarioEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditUsuarioTitle}">
            <h:form id="UsuarioEditForm">
                <h:panelGroup id="display">
                    <p:commandButton actionListener="#{usuarioController.update}" value="#{bundle.Save}" update="display,:UsuarioListForm:datalist,:growl" oncomplete="handleSubmit(args, 'UsuarioEditDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" immediate="true" onclick="UsuarioEditDialog.hide()"/>
                    <br /><br />
                    <p:fieldset legend="Principal" style="margin-bottom:20px">
                        <p:panelGrid columns="4" rendered="#{usuarioController.selected != null}">
                            <p:outputLabel value="#{bundle.CreateUsuarioLabel_login}" for="login" />
                            <p:inputText id="login" value="#{usuarioController.selected.login}" title="#{bundle.CreateUsuarioTitle_login}" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_login}"/>
                            <p:outputLabel value="#{bundle.CreateUsuarioLabel_funcao}" for="funcao" />
                            <p:selectOneMenu id="funcao" value="#{usuarioController.selected.funcao}">
                                <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                                <f:selectItem itemLabel="Administrador" itemValue="Administrador" />
                                <f:selectItem itemLabel="Recepcionista" itemValue="Recepcionista" />
                                <f:selectItem itemLabel="Secretária" itemValue="Secretária" />
                            </p:selectOneMenu>                        
                        </p:panelGrid>
                    </p:fieldset>              
                    <input type="password" name="password_fake" id="password_fake" value="" style="display: none;" />
                    <p:fieldset legend="Acesso Sistema" style="margin-bottom:20px">
                        <p:panelGrid columns="4" rendered="#{usuarioController.selected != null}">
                            <p:outputLabel for="ldap" value="Validação LDAP" />
                            <p:selectOneMenu id="ldap" value="#{usuarioController.selected.ldap}" required="true" requiredMessage="Campo Validação LDAP Obrigatório">
                                <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                                <f:selectItem itemLabel="Sim" itemValue="S" />
                                <f:selectItem itemLabel="Não" itemValue="N" />
                            </p:selectOneMenu>
                            <p:outputLabel value="Para alterar a senha preencha o campo" for="senha" />
                            <p:password id="senha" value="#{usuarioController.selected.senha}"  redisplay="false" title="#{bundle.EditUsuarioTitle_senha}" required="false" immediate="true"> 
                                <f:validateBean disabled="true" />
                            </p:password>
                        </p:panelGrid>
                    </p:fieldset>                        
                    <p:commandButton actionListener="#{usuarioController.update}" value="#{bundle.Save}" update="display,:UsuarioListForm:datalist,:growl" oncomplete="handleSubmit(args, 'UsuarioEditDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" immediate="true" onclick="UsuarioEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
